 #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int f[110][5]={0};
struct node{int x,y,next;}a[210];int last[110],len=0;
void ins(int x,int y)
{
    len++;
    a[len].x=x;a[len].y=y;a[len].next=last[x];last[x]=len;
}
bool bk[110]={0};
void treedp(int x)
{
    f[x][2]=1;
    int minn=9999999,c=0,t=0;
    for(int k=last[x];k;k=a[k].next)
    {
        int y=a[k].y;
        if(bk[y]==0)
        {
            bk[y]=1;
            treedp(y);
            f[x][2]+=f[y][1];
            if(f[y][0]>f[y][2])
            {
                minn=min(minn,f[y][0]-f[y][2]);
                t+=f[y][2];
                c++;
            }
            else
            {
                minn=min(minn,f[y][2]-f[y][0]);
                t+=f[y][0];
            }
        }
    }
    if(c%2==1)
    {
        f[x][1]=t+minn;
        f[x][0]=t;
    }
    else
    {
        f[x][1]=t;
        f[x][0]=t+minn;
    }
}
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        memset(last,0,sizeof(last));
        len=0;
        if(n==0) return 0;
        for(int i=1;i<n;i++)
        {
            int x,y;scanf("%d%d",&x,&y);
            ins(x,y);ins(y,x);
        }
        memset(bk,0,sizeof(bk));
        memset(f,0,sizeof(f));
        int root=1;bk[root]=1;
        treedp(root);
        printf("%d\n",min(f[root][0],f[root][2]));
    }
    return 0;
} 
